<?php

class voteModule extends Module {
	/*
	 * 在构造函数中装载所依赖的类或其他文件
	*/
	function __construct() {
		$this->includePhp('vote', 'vote');
	}
	
	
	/*
	 * 调用插件资源
	*/
	public function call($user, $method, $param) {
		
		switch ($method) {
			case "rule":
			    $actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    vote::getRule($param);
			    break;
			case "index":
				$actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				vote::getIndex($param);
			    break;
			case "reg":
				$actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				vote::getReg($param);
			    break;
			case "detail":
				$actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				vote::getDetail($param);
			    break;
			case "list":
				$actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				vote::getList($param);
			    break;
			case "saveReg":
				$actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				vote::saveReg($param);
			    break;
		   case "rankinglist":
		        $actId = $param->actId;
		        if (!isset($actId)) {
		            Output::instance()->resultCode(code_lackof_param);
		            return;
		        }
		        vote::getrankinglist($param,$param->start,$param->limit);
		        break;
		   case "vote":
			     $rId = $param->rId;			            
			     if (!isset($rId)) {
			         Output::instance()->resultCode(code_lackof_param);
			         return;
			     }
			     vote::addvote($param);
			     break;
	       case "getActivityVoteById":
			     $id = $param->id;
			     if (!isset($id)) {
			        Output::instance()->resultCode(code_lackof_param);
			        return;
			     }
			     vote::getActivityVoteById($param);
			     break;
			case "prize":
				$actId = $param->actId;
				if (!isset($actId)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				vote::getPrize($param);
				break;
		
		}
	}
}


$module = new voteModule();
Module::addModule($module);
?>